/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.pdx.cs.guavadata.condition;

import edu.pdx.cs.guavadata.domain.Domain;
import edu.pdx.cs.guavadata.subclass.ConditionType;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author VuTran
 */
public class NotNullCond extends Condition {

    public NotNullCond(List<Object> args) throws ConditionException {
        if (args.size() != getNumArgs())
            throw new ConditionException("You have specified the wrong number of conditions (" + args.size() + ") for an equality predicate.", getNumArgs());
    }

    @Override
    public String toString() {
        return " IS NOT NULL";
    }

    @Override
    public ConditionType getCondType() {
        return ConditionType.ISNOTNULL;
    }

    @Override
    public final int getNumArgs() {
        return 0;
    }

    @Override
    public List<Object> getArgs() {
        return new ArrayList<Object>();
    }

    @Override
    public boolean equals(Object obj) {
        return (obj instanceof NotNullCond);
    }

    @Override
    public int hashCode() {
        return this.getClass().hashCode();
    }

    @Override
    public boolean getNeedsOrdered() {
        return false;
    }

    @Override
    public boolean getNeedsContain() {
        return false;
    }

    @Override
    public boolean Validate(Object obj, Domain d) {
        return (obj != null);
    }
}
